package com.zt.mapper;

import com.zt.pojo.Dept;
import org.apache.ibatis.annotations.*;

import java.util.List;
@Mapper
public interface DeptMapper {
    @Select("select * from dept order by update_time desc")
    List<Dept> findAll();
    @Delete("delete from dept where id = #{id}")
    void deleteById(Integer id);
    @Insert("insert into dept values(#{id},#{name},#{createTime},#{updateTime})")
    void add(Dept dept);
    @Select("select * from dept where id = #{id}")
    Dept findById(Integer id);
    @Update("update dept set name = #{name},update_time = #{updateTime} where id = #{id} order by update_time")
    void update(Dept dept);
    @Select("select count(*) from emp where dept_id = #{id}")
    Integer findempById(Integer id);
}
